<?php
	require_once("pre.php");
	require_once("auth.php");
?>
<?php if(! est_autorise("acces_clients")) exit; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require_once("title.php"); ?>
<?php
	require_once("../classes/Rubrique.class.php");
	require_once("../fonctions/divers.php");
	require_once("../classes/Client.class.php");
	require_once("../classes/Pays.class.php");
	require_once("../classes/Paysdesc.class.php");


?>



<?php
	$client = new Client();

	$client->charger_ref($ref);

	if($client->raison == "1") $raison1 = "checked=\"checked\""; else $raison1="";
	if($client->raison == "2") $raison2 = "checked=\"checked\""; else $raison2="";
	if($client->raison == "3") $raison3 = "checked=\"checked\""; else $raison3="";

?>
</head>

<body>

<div id="wrapper">
<div id="subwrapper">

<?php
	$menu="client";
	require_once("entete.php");
?>

<div id="contenu_int">
<p><a href="accueil.php" class="lien04"><?php echo trad('Accueil'); ?> </a><img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="client.php" class="lien04"><?php echo trad('Gestion_clients'); ?></a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04"><?php echo trad('Modifier'); ?></a></p>

<!-- Début de la colonne de gauche -->
<div id="bloc_description">
<form action="client_visualiser.php" id="formulaire" method="post">
<input type="hidden" name="action" value="modifier" />
<input type="hidden" name="ref" value="<?php echo($ref); ?>" />
<!-- bloc de modification client -->
	<div class="entete_liste_client">
			<div class="titre"><?php echo trad('INFO_CLIENT'); ?></div>
			<div class="fonction_valider"><a href="#" onclick="document.getElementById('formulaire').submit()"><?php echo trad('VALIDER_LES_MODIFICATIONS'); ?></a></div>

</div>

<table width="100%" cellpadding="5" cellspacing="0" style="clear: both;">
    <tr class="claire">
        	<th class="designation" width="290"><?php echo trad('Societe'); ?></th>
       		<th><input name="entreprise" type="text" class="form" value="<?php echo htmlspecialchars($client->entreprise); ?>" size="40" /></th>
     </tr>
      <tr class="fonce">
       		<td class="designation"><?php echo trad('Siret'); ?></td>
       		<td><input name="siret" type="text" class="form" value="<?php echo htmlspecialchars($client->siret); ?>" size="40" /></td>
     </tr>
      <tr class="claire">
       <td class="designation"><?php echo trad('Numintracom'); ?></td>
       <td><input name="intracom" type="text" class="form" value="<?php echo htmlspecialchars($client->intracom); ?>" size="40" /></td>
     </tr>
     <tr class="fonce">
       <td class="designation"><?php echo trad('Civilite'); ?></td>
       <td>
         <input name="raison" type="radio" class="form" value="1" <?php echo($raison1); ?>/>
Madame
<input name="raison" type="radio" class="form" value="2" <?php echo($raison2); ?> />
Mademoiselle
<input name="raison" type="radio" class="form" value="3" <?php echo($raison3); ?> />
Monsieur</td>
     </tr>
     <tr class="claire">
       <td class="designation"><?php echo trad('Nom'); ?></td>
       <td><input name="nom" type="text" class="form" value="<?php echo htmlspecialchars($client->nom); ?>" size="40" /></td>
     </tr>
     <tr class="fonce">
       <td class="designation"><?php echo trad('Prenom'); ?></td>
       <td class="cellule_claire">
         <input name="prenom" type="text" class="form" value="<?php echo htmlspecialchars($client->prenom); ?>" size="40" /></td>
     </tr>
     <tr class="claire">
       <td class="designation"><?php echo trad('Adresse'); ?></td>
       <td><input name="adresse1" type="text" class="form" value="<?php echo htmlspecialchars($client->adresse1); ?>" size="40" /></td>
     </tr>
     <tr class="fonce">
       <td class="designation"><?php echo trad('Adressesuite'); ?></td>
       <td><input name="adresse2" type="text" class="form" value="<?php echo htmlspecialchars($client->adresse2); ?>" size="40" /></td>
     </tr>
     <tr class="claire">
       <td class="designation"><?php echo trad('Adressesuite'); ?> 2</td>
       <td><input name="adresse3" type="text" class="form" value="<?php echo htmlspecialchars($client->adresse3); ?>" size="40" /></td>
     </tr>
     <tr class="fonce">
       <td class="designation"><?php echo trad('CP'); ?></td>
       <td><input name="cpostal" type="text" class="form" value="<?php echo htmlspecialchars($client->cpostal); ?>" size="40" /></td>
     </tr>
     <tr class="claire">
       <td class="designation"><?php echo trad('Ville'); ?></td>
       <td><input name="ville" type="text" class="form" value="<?php echo htmlspecialchars($client->ville); ?>" size="40" /></td>
     </tr>
     <tr class="fonce">
       <td class="designation"><?php echo trad('Pays'); ?></td>
       <td>
    <select name="pays" class="form_client">
     <?php
      	$pays = new Pays();
      	$query ="select * from $pays->table";

      	$resul = mysql_query($query, $pays->link);
      	while($row = mysql_fetch_object($resul)){
			$paysdesc = new Paysdesc();
			if ($paysdesc->charger($row->id, $_SESSION["util"]->lang)) {
			if($row->id == $client->pays) $selected="selected=\"selected\""; else $selected="";

      ?>

      <option value="<?php echo($row->id); ?>" <?php echo($selected); ?>><?php echo($paysdesc->titre); ?></option>

      <?php
			}
      }
	  ?>

      </select>
	</td>
     </tr>
     <tr class="claire">
       <td class="designation"><?php echo trad('Telfixe'); ?></td>
       <td><input name="telfixe" type="text" class="form" value="<?php echo htmlspecialchars($client->telfixe); ?>" size="40" /></td>
     </tr>
     <tr class="fonce">
       <td class="designation"><?php echo trad('Telport'); ?></td>
       <td><input name="telport" type="text" class="form" value="<?php echo htmlspecialchars($client->telport); ?>" size="40" /></td>
     </tr>
     <tr class="claire">
       <td class="designation"><?php echo trad('E-mail'); ?></td>
       <td><input name="email" type="text" class="form" value="<?php echo htmlspecialchars($client->email); ?>" size="40" /></td>
     </tr>
     <tr class="fonce">
       <td class="designation"><?php echo trad('Remise'); ?></td>
       <td><input name="pourcentage" type="text" class="form" value="<?php echo htmlspecialchars($client->pourcentage); ?>" size="40" /></td>
     </tr>
     <tr class="clairebottom">
       <td class="designation"><?php echo trad('Revendeur'); ?></td>
       <td><input type="checkbox" name="type" <?php if($client->type) { ?> checked="checked" <?php } ?> class="form"/></td>
     </tr>
   </table>

</div>
<!-- fin du bloc description -->
</form>
   </div>
   <?php require_once("pied.php");?>
</div>
</div>
</body>
</html>
